#ifndef SELECTCOMM_H
#define SELECTCOMM_H
#include "SQLSystem.h"
#include "Command.h"
#include "Helper.h"
class SelectCommand :
	public Command
{
public:
	SelectCommand(SQLSystem* sql);
	~SelectCommand();
	virtual int execute(string str);
	//this virtual function execute the core of the command
	//the body will call printRows function to print choose the selected rows and display it.

	void printRows(vector<string> columns, string wherePart, Table* table);
	//analyze the wherePart param to determine the column name, the operator and the value for comparison
	//call compareCell and displaySelectedRows functions

	bool compareCell(string s_operator, string data, Cell* p_cell, int type);
	//given the operator, the data for comparison, the cell to compare and its type
	//return true if comparison succeed or false otherwise.

	void displaySelectedRows(vector<string> columnsToDisplay, vector<Row *> rowsToDisplay, vector<int> types, Table* table); 
	//given the columns to be display and the selected rows, the types of the whole table and a pointer to the original table
	//display the set of result in the correct format.

	Helper* helper;	//contains useful methods
};

#endif